Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/dcons

Package Overview
Dependencies
Maintainers
1
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/dcons

Comprehensive doubly linked list structure w/ iterator support

  • 0.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
increased by33.5%
Maintainers
1
Weekly downloads
 
Created
Source

@thi.ng/dcons

npm (scoped)

This project is part of the @thi.ng/umbrella monorepo.

About

Comprehensive doubly linked list structure with:

  • ES6 iterator support
  • Stack & queue API (front and/or back)
  • Random node access (read / write, O(n/2))
  • Node insertion (also w/ custom comparator)
  • Node finding (O(n))
  • Node swaps (O(1))
  • Reversing (O(n/2))
  • Rotation (left / right) (O(1))
  • Shuffling
  • Slicing (sublist copies)
  • Splicing (delete and/or insert)
  • release() (emptying, GC friendly)
  • concat() / into()
  • map() / filter() / reduce()
  • compare() / equiv()
  • toJSON() transform (-> array)

Installation

yarn add @thi.ng/dcons

Usage

// ES5
DCons = require("@thi.ng/dcons").DCons;

// ES6 / TS
import { DCons } from "@thi.ng/dcons";

API

list = new DCons([1, 2, 3]);
list.length
[...list]

Head centric

  • cons()
  • first()
  • drop()
  • setHead()

Tail centric

  • into()
  • push()
  • peek()
  • pop()
  • setTail()

Random Access

  • .length
  • nth()
  • setNth()

Insertion

  • insertBefore()
  • insertAfter()
  • insertBeforeNth()
  • insertAfterNth()
  • insertSorted()

Finding

  • find()
  • findWith()

Structure

  • copy()
  • concat()
  • slice()
  • splice()
  • swap()
  • shuffle()
  • reverse()
  • rotateLeft()
  • rotateRight()
  • release()

TODO...

Authors

  • Karsten Schmidt

License

© 2017-2018 Karsten Schmidt // Apache Software License 2.0

Keywords

FAQs

Package last updated on 10 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc